namespace player
{
    public class FallState : State
    {
        public override bool Check() => base.Check() && player.GetVelocity(1) < 0;

        public override void Process()
        {
            base.Process();

            if (player.IsGroundDetected() && player.TryChangeState(StateCode.Idle)) return;
            if (player.TryChangeState(StateCode.WallSlide)) return;

            float yVelocity = player.GetVelocity(1);
            animator.SetFloat("yVelocity", yVelocity);
            if (player.moveInput.x != 0) player.SetVelocity(player.moveInput.x * player.moveSpeed, yVelocity);
        }
    }
}